<?php 
	include('function/connection.php');
	$cat_id = $category = $des  = "";
	$action ="insert";
	$btn = "Save";
	
	// Select customer info
	if(isset($_GET['cat_id'])){
		$querySelectCustomer = "SELECT * FROM tbl_category WHERE cat_id= $_GET[cat_id]";
		$result = mysql_query($querySelectCustomer);
		$row = mysql_fetch_array($result);
			$cat_id = $row['cat_id'];
			$category = $row['cat_name'];
			$des = $row['description'];
			
			$action = "update&cat_id=".$_GET['cat_id'];		
			$btn = "Update";
			
	}
?>

<form action="category_verify.php?action=<?php echo $action ?>" method="post" >
	<table class="bordered" width="770">
        <thead>
            <tr>
                <th>Please insert your Category information:<br /><span class="red">* require feild</span></th>
            </tr>
        </thead>
        <tr>
    	<?php 
			if(isset($_REQUEST['msgStatus']))
				echo " <td ><span class='red'>". $_REQUEST['msgStatus']."</span></td>";
		?>
    </tr>
	</table>
    <table class="bordered" width="770">
		<tr>
        	<td>
            	<label><span class="red">*</span> Category:</label>
            </td>
			<td >
            	<input type="hidden" name="txtcat_id" value="<?php echo $cat_id;?>"  />
				<input type="text" class="txtID" name="txtcategory" value="<?php echo $category;?>" /> 
            </td>           
		</tr>
        <tr>
        	<td>
            	<label> Description:</label>
            </td>
        	<td >
                <textarea name="txtdes" cols="50" rows="10"><?php echo $des ?></textarea>
            </td>
        </tr>
		<tr>
        	<td></td>
			<td ><input type="submit" class="btnSubmit" name="btnSubmit" value="<?php echo $btn ?>" />&nbsp; 
            <input type="button" class="btnSubmit" name="btnSubmit" value="Cancel" onclick="redirect('index.php?page=category_list&action=category_list')" /></td>
		</tr>
	</table>
</form>